﻿using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows;

namespace xCarLinkMP3Organizer
{
    internal class GetWinampPlayList : WinampCommand
    {
        public IEnumerable<string> Files { get; private set; }

        protected override void InternalExecute(ProcessStartInfo psi, DiscViewModel dvm)
        {
            if (!WinampLib.IsOpened())
            {
                MessageBox.Show("Winamp is not loaded.");
                return;
            }

            WinampLib.SavePlaylist();

            Files = PlayList.Load(GetPlaylistPath());
        }

        protected string GetPlaylistPath()
        {
            return Path.Combine(GetPlaylistDir(), "Winamp.m3u");
        }
    }
}